Fix Claude code review workflow authentication and bot handling#11
Fix Claude code review workflow authentication and bot handling#11bedaHovorka merged 3 commits intodevelopfrom
Conversation
Add github_token to claude-code-action to fix authentication error. The workflow was failing with "User does not have write access on this repository" because it was trying to use OIDC token exchange without proper GitHub App permissions. Using the standard GITHUB_TOKEN secret resolves this. Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
|
same problem : |
|
GET /repos/bedaHovorka/interlockSim/collaborators/Copilot/permission - 404 with id in 274ms @copilot solve it please |
|
@claude : could you please review? |
|
Claude finished @bedaHovorka's task in 1m 0s —— View job Code Review Complete ✅Todo List:
Review SummaryThe change looks correct and appropriate for fixing the authentication issue. This is a minimal, targeted fix that addresses the root cause. What ChangedAdded explicit github_token: ${{ secrets.GITHUB_TOKEN }}Analysis✅ Correctness
✅ Security
✅ Best Practices
Potential Issues
|
|
@copilot : could you please fix it too? The job failed because it attempted to check permissions for the user "Copilot," but "Copilot" is not an actual GitHub user—this caused a permissions-check error and the workflow exited with code 1. The relevant line from your job log: Failed to check permissions: HttpError: Copilot is not a user Solution: If your workflow or an action needs to check permissions or assign reviewers, ensure that the username supplied is valid and matches an actual GitHub user, team, or automation bot with the correct permissions. Avoid hardcoding "Copilot" unless it is a real user/bot in your organization. Code suggestion: // Example problematic logic
const username = process.env.GITHUB_ACTOR;
if (username === "Copilot") {
// permission check
}Replace or remove such references to "Copilot" unless valid, or use a generic service account with proper access. You can find the job definition in your workflow here: .github/workflows/claude-code-review.yml (ref: bd483334b1eaaee9b9da36ed3969d971d1478de8). Summary of fix:
|
bedaHovorka
left a comment
There was a problem hiding this comment.
@copilot in comment
#11 (comment)
I described anohter issue
Add conditional check to prevent workflow from running on PRs created by Copilot or other bots. The workflow was failing with "Copilot is not a user" error because the claude-code-action tries to check permissions for the PR author, and bot users like "Copilot" are not recognized as valid GitHub users by the collaborators API. The workflow will now only run for PRs created by human users. Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
Fixed in commit 6ffdc46. Added an if: |
github.event.pull_request.user.login != 'Copilot' &&
github.event.pull_request.user.type != 'Bot'This prevents the permissions check error for bot users. The workflow will now only run for human-authored PRs.
Fixed in commit 6ffdc46. Added conditional check to skip the workflow for bot-created PRs. The |
|



The
claude-code-review.ymlworkflow was failing with authentication errors and permission check failures when attempting to post automated PR reviews. The workflow was added in PR #9 and has never successfully posted a review comment.Changes
Added GitHub token authentication: Added
github_token: ${{ secrets.GITHUB_TOKEN }}input toanthropics/claude-code-action@v1to fix initial OIDC token exchange errors.Skip workflow for bot-created PRs: Added conditional check to prevent the workflow from running on PRs created by bots (Copilot, Dependabot, etc.), which were causing
HttpError: Copilot is not a userfailures when the action attempted to check permissions via the GitHub collaborators API.The workflow will now successfully post automated code review comments on PR open/update events for human-authored pull requests, while gracefully skipping bot-created PRs that would cause permission check errors.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.